makeSceneTransitionAnimation

open fun makeSceneTransitionAnimation(@NonNull activity: Activity, @NonNull sharedElement: View, @NonNull sharedElementName: String): ActivityOptionsCompat(source)

Create an ActivityOptions to transition between Activities using cross-Activity scene animations. This method carries the position of one shared element to the started Activity. The position of sharedElement will be used as the epicenter for the exit Transition. The position of the shared element in the launched Activity will be the epicenter of its entering Transition.

This requires FEATURE_CONTENT_TRANSITIONS to be enabled on the calling Activity to cause an exit transition. The same must be in the called Activity to get an entering transition.

Return

Returns a new ActivityOptions object that you can use to supply these options as the options Bundle when starting an activity.

Parameters

activity

The Activity whose window contains the shared elements.

sharedElement

The View to transition to the started Activity. sharedElement must have a non-null sharedElementName.

sharedElementName

The shared element name as used in the target Activity. This may be null if it has the same name as sharedElement.


Create an ActivityOptions to transition between Activities using cross-Activity scene animations. This method carries the position of multiple shared elements to the started Activity. The position of the first element in sharedElements will be used as the epicenter for the exit Transition. The position of the associated shared element in the launched Activity will be the epicenter of its entering Transition.

This requires FEATURE_CONTENT_TRANSITIONS to be enabled on the calling Activity to cause an exit transition. The same must be in the called Activity to get an entering transition.

Return

Returns a new ActivityOptions object that you can use to supply these options as the options Bundle when starting an activity.

Parameters

activity

The Activity whose window contains the shared elements.

sharedElements

The names of the shared elements to transfer to the called Activity and their associated Views. The Views must each have a unique shared element name.